<template>
    <view class="scope-float-btn-c data-v-d302dce4">
        <image
            @tap="__e"
            :class="['free-times-icon', 'data-v-d302dce4', isAnimate ? 'float-icon-animate' : '']"
            :data-event-opts="[['tap', [['handleClick', ['$event']]]]]"
            mode="widthFix"
            src="https://cdn2.hquesoft.com/box/home/free-float-btn.png"
        ></image>
        <view @tap="__e" class="free-stock data-v-d302dce4" :data-event-opts="[['tap', [['handleUseFreeTime', ['$event']]]]]" v-if="stock">{{ stock + '次机会' }}</view>
    </view>
</template>

<script>
import tabBar from '@/components/TabBar/tabBar';
(global.webpackJsonp = global.webpackJsonp || []).push([
    ['components/FreeTicketFloatBtn/FreeTicketFloatBtn'],
    {
        '0773': function (t, e, n) {
            'use strict';

            n.d(e, 'b', function () {
                return i;
            });
            n.d(e, 'c', function () {
                return o;
            });
            n.d(e, 'a', function () {});
            var i = function () {
                this.$createElement;
                this._self._c;
            };
            var o = [];
        },
        '27f4': function (t, e, n) {},
        '70f6': function (t, e, n) {
            'use strict';

            n.r(e);
            var i = n('f29a');
            var o = n.n(i);
            for (var a in i) {
                if (['default'].indexOf(a) < 0) {
                    (function (t) {
                        n.d(e, t, function () {
                            return i[t];
                        });
                    })(a);
                }
            }
            e.default = o.a;
        },
        e84d: function (t, e, n) {
            'use strict';

            var i = n('27f4');
            n.n(i).a;
        },
        ef0dd: function (t, e, n) {
            'use strict';

            n.r(e);
            var i = n('0773');
            var o = n('70f6');
            for (var a in o) {
                if (['default'].indexOf(a) < 0) {
                    (function (t) {
                        n.d(e, t, function () {
                            return o[t];
                        });
                    })(a);
                }
            }
            n('e84d');
            var c = n('f0c5');
            var u = Object(c.a)(o.default, i.b, i.c, false, null, 'd302dce4', null, false, i.a, void 0);
            e.default = u.exports;
        },
        f29a: function (t, e, n) {
            'use strict';

            (function (t) {
                Object.defineProperty(e, '__esModule', {
                    value: true
                });
                e.default = void 0;
                var n = {
                    props: {
                        uuid: String,
                        nodeType: String
                    },
                    data: function () {
                        return {
                            inviteTotal: 0,
                            usedTotal: 0,
                            stock: 0,
                            title: ''
                        };
                    },
                    computed: {
                        isAnimate: function () {
                            return true;
                        }
                    },
                    created: function () {
                        var that = this;
                        this.initData();
                        t.$on('refreshFreeTicketTotal', function () {
                            that.initData();
                        });
                    },
                    methods: {
                        handleClick: function () {
                            t.navigateTo({
                                url: '/pages/activityTicket/record?uuid=' + this.uuid + '&node_type=' + this.nodeType
                            });
                        },
                        handleUseFreeTime: function () {
                            var that = this;
                            t.showModal({
                                title: '操作提示',
                                content: '确定使用一次免费抽奖机会吗？',
                                confirmText: '确定使用',
                                cancelText: '暂不',
                                success: function (t) {
                                    if (t.confirm) {
                                        that.$emit('useFreeTicket');
                                        setTimeout(function () {
                                            that.initData();
                                        }, 1000);
                                    }
                                }
                            });
                        },
                        initData: function () {
                            var that = this;
                            if (!this.uuid) {
                                return false;
                            }
                            this.$http('/activity/ticket-total', 'GET', {
                                node_type: this.nodeType,
                                uuid: this.uuid
                            }).then(function (e) {
                                that.inviteTotal = e.data.invite_total;
                                that.usedTotal = e.data.used_total;
                                that.stock = e.data.stock;
                                that.title = e.data.title;
                            });
                        }
                    },
                    watch: {
                        uuid: function (t) {
                            this.initData();
                        }
                    }
                };
                e.default = n;
            }.call(this, n('543d').default));
        }
    }
]);
(global.webpackJsonp = global.webpackJsonp || []).push([
    'components/FreeTicketFloatBtn/FreeTicketFloatBtn-create-component',
    {
        'components/FreeTicketFloatBtn/FreeTicketFloatBtn-create-component': function (t, e, n) {
            n('543d').createComponent(n('ef0dd'));
        }
    },
    [['components/FreeTicketFloatBtn/FreeTicketFloatBtn-create-component']]
]);
</script>
<style>
@import './FreeTicketFloatBtn.css';
</style>
